FIND_PACKAGE(GTest 
                CONFIG REQUIRED
                PATHS /home/shengyi/install/gtest/lib/cmake/GTest)

if (GTest_FOUND)
    GET_PROPERTY(include_def TARGET GTest::gtest PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
    GET_PROPERTY(library_def TARGET GTest::gtest PROPERTY INTERFACE_LINK_LIBRARIES)
    MESSAGE("Found gtest libs, include: ${include_def}, library: ${library_def}")
    ADD_EXECUTABLE(main main.cpp)
    TARGET_LINK_LIBRARIES(main GTest::gtest)
endif()

include(GoogleTest)
gtest_add_tests(TARGET main)